File Checker - Internetwache CTF 2016
It checks if there is a file named .password in current directory.
Then, it reads the file contents and judge in the below function.
code: c
void fcn.0040079c(int64_t arg1, int64_t arg2)
{
(.. snip ..)
var_44h._4_4_ = 0x12ee;
var_3ch = 0x12e0;
var_38h = 0x12bc;
var_34h = 0x12f1;
var_30h = 0x12ee;
var_2ch = 0x12eb;
var_28h = 0x12f2;
var_24h = 0x12d8;
var_20h = 0x12f4;
var_1ch = 0x12ef;
var_18h = 0x12d2;
var_14h = 0x12f4;
var_10h = 0x12ec;
var_ch = 0x12d6;
var_8h = 0x12ba;
*(int32_t *)arg2 = (*(int32_t *)((int64_t)&var_44h + (int64_t)(int32_t)arg1 * 4 + 4) + *(int32_t *)arg2) % 0x1337;
return;
}
This function is used by main function, and return value(arg2) should be 0
arg1 is a character written in .password, so we can calculate the flag by subtracting each integer from 0x1337
In summary, The flag can be calculate by the following code.
code: python
i = '0x12ee', '0x12e0', '0x12bc', '0x12f1', '0x12ee', '0x12eb', '0x12f2', '0x12d8', '0x12f4', '0x12ef', '0x12d2', '0x12f4', '0x12ec', '0x12d6', '0x12ba'
''.join(chr(0x1337 - int(c, 16)) for c in i)
IW{FILE_CHeCKa}